<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title></title>
</head>
<body class="easyui-layout">
	<!-- top框架 -->
	<div data-options="region:'north',border:true" style=" width: 100%; background: #F2F2F2; height: 60px; padding: 1px; overflow: hidden; position: relative;">
		<div style="float: left;padding-top:10px;padding-left:30px;width:350px;height:60px;">
			<span style="font-size:30px;font-weight:bold; color:#666666"><@h.sitename /></span>
		</div>
		<div style="float: right; padding-top:15px; padding-right:35px;">
			 欢迎您：<a href="javascript:void(0)" class="easyui-menubutton" data-options="menu:'#top_mm2',iconCls:'icon-man'">${rolename!''}&nbsp;${truename!''}</a>
			<div id="top_mm2">
				<div class="easyui-linkbutton" data-options="onClick:updatepwd">修改密码</div>
			</div>
		</div>
		<div id="win_uppwd" class="easyui-window" title="修改密码" data-options="iconCls:'icon-edit',closed:true,modal:true,maximizable:false,minimizable:false,collapsible:false" style="width:300px;height:210px;padding:10px;">
			<form id="upwd_form" method="post" class="easyui-form" data-options="novalidate:true">
				<table>
					<tr>
						<td width="80px;">旧&nbsp;密&nbsp;码：</td>
						<td><Input type="password" name="oldpw" class="easyui-textbox" data-options="required:true,missingMessage:'旧密码为必填项'" /></td>
					</tr>
					<tr>
						<td colspan="2">&nbsp;</td>
					</tr>
					<tr>
						<td>新&nbsp;密&nbsp;码：</td>
						<td><Input type="password" name="newpw" id="upwd_newpwd" class="easyui-textbox" data-options="required:true,missingMessage:'新密码为必填项'" /></td>
					</tr>
					<tr>
						<td colspan="2">&nbsp;</td>
					</tr>
					<tr>
						<td>确认密码：</td>
						<td><Input type="password" class="easyui-textbox" name="repw" data-options="required:true,validType:'equals[\'upwd_newpwd\']',invalidMessage:'需要与新密码保持一致',missingMessage:'确认密码为必填项'" /></td>
					</tr>
					<tr>
						<td colspan="2">&nbsp;</td>
					</tr>
					<tr align="center">
						<td colspan="2"><a class="easyui-linkbutton" id="btn_save_upwd" data-options="iconCls:'icon-save'" href="javascript:void(0)">修改</a></td>
					</tr>
				</table>
			</form>
		</div>
	</div>
	
	<!-- 菜单框架 -->
	<div data-options="region:'west',split:true,title:'工作菜单'" style="width:200px;padding:0px;">
		<div id="myAccording" class="easyui-accordion" data-options="border:false" style="width:100%;height:100%;">
		</div>
	</div>
	<!-- 主页面 -->
	<div data-options="region:'center',title:'主页面'">
		<div id="systemTabs" class="easyui-tabs" data-options="fit:true,border:true">
          <div id="firstTab" title="首页" style="padding:10px;overflow:hidden;">
            <div style="margin-top:20px;">
									<h1>公告信息</h1>
								</div>
          </div>
        </div>
	</div>
	<div data-options="region:'south'" style="height:20px;text-align:center">
		Copyright &#169;<@h.tcompany />
	</div>
</body>
</html>
<@h.easyui />
<@h.zTree />
<script type="text/javascript">
//修改密码
function updatepwd(){
	jQuery("#win_uppwd").window("open");
	jQuery("#win_uppwd").window("center");
	jQuery("#upwd_form").form("clear");
}
var setting={
		data:{
			key:{
				//url:"MENU_URL",
				name:"MENU_NAME"
			},
			simpleData:{
				idKey:"CODE",
				pIdKey:"P_CODE",
				rootPid:0,
				enable: true
			}
		},
		callback:{onClick:zTreeOnClick}
};
jQuery(document).ready(function(){
	//修改密码保存
	jQuery("#btn_save_upwd").click(function(){
		if(!jQuery("#upwd_form").form("enableValidation").form("validate")){
			return;
		}
		jQuery("#upwd_form").form("submit",{
			success:function(data){
				var obj = eval('(' + data + ')');
				if(obj.success){
					jQuery.messager.alert("系统提示","修改密码成功","info");
					jQuery("#upwd_form").form("clear");
					jQuery("#upwd_form").form("disableValidation");
					jQuery("#win_uppwd").window("close");
				}else{
					jQuery.messager.alert("系统提示",obj.message,"info");
				}
			},
			url:"sys/user/uppwd"
		});
	});
	jQuery.getJSON("/sys/menu/leftTree",function(data){
		jQuery.each(data,function(k,v){
			jQuery("#myAccording").accordion("add", {
				title: v.MENU_NAME,
				content: '<div id="tree'+k+'" class="ztree"></div>',
				selected: false
			});
			jQuery.getJSON("/sys/menu/leftTree?code="+v.CODE, function(zNodes){
				setting.data.simpleData.rootPid=v.CODE;
				var treeObj = $.fn.zTree.init($("#tree"+k), setting, zNodes);
				treeObj.expandAll(true);
			});
		});
	});
});
//zTree添加tab页面
function zTreeOnClick(event, treeId, treeNode, clickFlag) {
	treeNode.click = "return false;"
	var id = treeNode.CODE;
	var url = treeNode.MENU_URL;
	if(url=="")
		return;
	var name = treeNode.MENU_NAME;
	if (treeNode.pid == 0) {
		return false;
	}
	qxTabAdd("tab_" + id, "iframe_" + id, name, url, true);
	return false;
};
//添加tab
function qxTabAdd(tabId, iframeId, tabTitle, tabHref, isCloseMenu) {
	var content = '<iframe  scrolling="yes"    id="' + iframeId
			+ '"  class="tabIframe" frameborder="0" src="' + tabHref
			+ '" style="width:100%;height:100%;"></iframe>';
	var systemTabs = jQuery('#systemTabs');
	var title = jQuery.trim(tabTitle);
	if (systemTabs.tabs('exists', title)) {
		systemTabs.tabs('select', title);
		return;
	}
	jQuery('#systemTabs').tabs('add', {
		id : "tabs_" + tabId,
		title : tabTitle,
		content : content,
		closable : true
	});
	if (isCloseMenu | false) {
		jQuery('#systemTabs').tabs('close', {
			forceClose : true
		});
	}
};
//关闭
function qxTabClose() {
	var currTitle = jQuery('#systemTabs').tabs("getSelected").panel(
			'options').title;
	jQuery('#systemTabs').tabs('close', currTitle);
}
</script>